package com.jy.oms.framework.asyn.task.core;

import java.util.List;

/**
 * task容错配置
 *
 * @author liuquan
 */
public class ExecutorFailoverConfig {

    /**
     * 可运行的任务组名称
     */
    private List<String> ableExecuteTaskGroups;

    /**
     * 当添加的任务不在可运行任务组时，是否允许添加任务
     */
    private boolean ableAddTaskIfUnableExecute;

    /**
     * 当允许添加不能运行的任务时，默认的任务组名称，必须在ableExecuteTaskGroups内；
     * 如果不设置，则取ableExecuteTaskGroups第一个值作为默认任务组
     */
    private String defaultTaskGroupIfUnableExecute;

    public static ExecutorFailoverConfig create() {
        return new ExecutorFailoverConfig();
    }

    public List<String> getAbleExecuteTaskGroups() {
        return ableExecuteTaskGroups;
    }

    public ExecutorFailoverConfig setAbleExecuteTaskGroups(List<String> ableExecuteTaskGroups) {
        this.ableExecuteTaskGroups = ableExecuteTaskGroups;
        return this;
    }

    public boolean isAbleAddTaskIfUnableExecute() {
        return ableAddTaskIfUnableExecute;
    }

    public ExecutorFailoverConfig setAbleAddTaskIfUnableExecute(boolean ableAddTaskIfUnableExecute) {
        this.ableAddTaskIfUnableExecute = ableAddTaskIfUnableExecute;
        return this;
    }

    public String getDefaultTaskGroupIfUnableExecute() {
        return defaultTaskGroupIfUnableExecute;
    }

    public ExecutorFailoverConfig setDefaultTaskGroupIfUnableExecute(String defaultTaskGroupIfUnableExecute) {
        this.defaultTaskGroupIfUnableExecute = defaultTaskGroupIfUnableExecute;
        return this;
    }
}
